/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package LitText;

/**
 *
 * @author AHEMOH
 */
public class Tree {
    char Letter; //Буква
    int Count;   //Счетчик буквы в тексте
    Tree Left;   //Указатель на левое поддерево
    Tree Right;  //Указатель на правое поддерево
    Next Next;   //Указатель на следующую букву
    
    //Конструктор
    public Tree(char Letter){
        this.Letter = Letter;
        this.Count = 0;
        this.Left = null;
        this.Right = null;
        this.Next = null;
    }
    
    public Tree(){
        this.Letter = 0;
        this.Count = 0;
        this.Left = null;
        this.Right = null;
        this.Next = null;
    }
    
    @Override public String toString () {
        return this.Letter+"";
    }



}


class Next {
    Tree Letter;
    int Count;
    Next Another;
    Next Next;
    
    public Next(){
        this.Letter = null;
        this.Count = 0;
        this.Another = null;
        this.Next = null;        
    }
    @Override public String toString () {
        return this.Letter+"";
    }
    
}

class TreeTest{
    static public void Test(){
        Tree root = new Tree('a');
        root.Left = new Tree('c');
        root.Next = new Next();
        root.Next.Letter = root.Left;
        System.out.println(root.Letter);
        System.out.println(root.Left.Letter);
        System.out.println(root.Letter+"->"+root.Next.Letter.Letter);
        System.out.println(root+"->"+root.Next);
    }
}